home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / config / i386-emul / exception.s < prev    next >
Text File  |  1996-10-24  |  2KB  |  106 lines

  1. #    (C) 1995-96 AROS - The Amiga Replacement OS
  2. #    $Id: exception.s,v 1.7 1996/10/24 15:51:11 aros Exp $
  3. #    $Log: exception.s,v $
  4. #    Revision 1.7  1996/10/24 15:51:11  aros
  5. #    Use the official AROS macros over the __AROS versions.
  6. #
  7. #    Revision 1.6  1996/10/23 08:04:25  aros
  8. #    Use generated offsets which makes porting much easier
  9. #
  10. #    Revision 1.5  1996/09/11 16:54:27    digulla
  11. #    Always use __AROS_SLIB_ENTRY() to access shared external symbols, because
  12. #    some systems name an external symbol "x" as "_x" and others as "x".
  13. #    (The problem arises with assembler symbols which might differ)
  14. #
  15. #    Revision 1.4  1996/08/23 16:49:21    digulla
  16. #    With some systems, .align 16 aligns to 64K instead of 16bytes. Therefore
  17. #    I replaced it with .balign which does what we want.
  18. #
  19. #    Revision 1.3  1996/08/13 14:03:19    digulla
  20. #    Added standard headers
  21. #
  22. #    Revision 1.2  1996/08/01 17:41:10    digulla
  23. #    Added standard header for all files
  24. #
  25. #    Desc:
  26. #    Lang:
  27.  
  28. #*****************************************************************************
  29. #
  30. #   NAME
  31. #    AROS_LH0(void, Exception,
  32. #
  33. #   LOCATION
  34. #    struct ExecBase *, SysBase, 8, Exec)
  35. #
  36. #   FUNCTION
  37. #
  38. #   INPUTS
  39. #
  40. #   RESULT
  41. #
  42. #   NOTES
  43. #
  44. #   EXAMPLE
  45. #
  46. #   BUGS
  47. #
  48. #   SEE ALSO
  49. #
  50. #   INTERNALS
  51. #
  52. #   HISTORY
  53. #
  54. #******************************************************************************
  55.  
  56.     .include "machine.i"
  57.  
  58.     .text
  59.     .balign 16
  60.     .globl    _Exec_Exception
  61.     .type    _Exec_Exception,@function
  62. _Exec_Exception:
  63.     /* Get SysBase amd pointer to current task */
  64.     movl    4(%esp),%ebp
  65.     movl    ThisTask(%ebp),%edi
  66.  
  67.     /* Clear exception flag */
  68.     andb    $~TF_EXCEPT,tc_Flags(%edi)
  69.  
  70.     /* If the exception is raised out of Wait IDNestCnt may be >0 */
  71.     movb    IDNestCnt(%ebp),%ebx
  72.     /* Set it to a defined value */
  73.     movb    $0,IDNestCnt(%ebp)
  74.  
  75. exloop: /* Get mask of signals causing the exception */
  76.     movl    tc_SigExcept(%edi),%ecx
  77.     andl    tc_SigRecvd(%edi),%ecx
  78.     je    excend
  79.  
  80.     /* Clear bits */
  81.     xorl    %ecx,tc_SigExcept(%edi)
  82.     xorl    %ecx,tc_SigRecvd(%edi)
  83.  
  84.     /* Raise exception. Enable Interrupts */
  85.     movl    tc_ExceptData(%edi),%eax
  86.     leal    Enable(%ebp),%edx
  87.     pushl    %ebp
  88.     call    *%edx
  89.     pushl    %ebp
  90.     pushl    %eax
  91.     pushl    %ecx
  92.     movl    tc_ExceptCode(%edi),%edx
  93.     call    *%edx
  94.     leal    Disable(%ebp),%edx
  95.     pushl    %ebp
  96.     call    *%edx
  97.     addl    $20,%esp
  98.  
  99.     /* Re-use returned bits */
  100.     orl    %eax,tc_SigExcept(%edi)
  101.     jmp    exloop
  102.  
  103. excend: /* Restore IDNestCnt and return */
  104.     movb    %ebx,IDNestCnt(%ebp)
  105.     ret
  106.